#!/usr/env/bin python
#! coding:utf-8

"""
    项目相关配置信息

"""
import logging
from logging.config import fileConfig

import os

class Config:

    ## 系统路径
    BASE_DIR = os.path.abspath(os.path.dirname(__file__))

    SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'

    SYSTEM_POSTS_PER_PAGE = 3  # 每页显示的记录数

    ###　mail相关
    MAIL_SERVER = "smtp.163.com"
    MAIL_PORT = 25
    MAIL_USE_TLS = True
    MAIL_USE_TLS = False    #是否使用https
    MAIL_USERNAME = "work_seven@163.com"
    MAIL_PASSWORD = "yepiaochen1H"  # os.environ.get('MAIL_PASSWORD')
    FLASKY_MAIL_SUBJECT_PREFIX = "PyBlog"
    FLASKY_MAIL_SENDER = "blog admin < work_seven@163.com >"

    ### log相关
    LOG_NAME = 'app.log'


class DevConfig(Config):
    DEBUG = True
    ### log相关
    LOG_FILE = 'app.log'
    def __init__(self):
       super(DevConfig,self).__init__()


    #######################################
    ## 数据库相关 mysql
    ##pymysql
    #######################################
    #see http://docs.sqlalchemy.org/en/latest/dialects/mysql.html#module-sqlalchemy.dialects.mysql.pymysql
    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://{}:{}@{}:{}/{}".format('root','root','localhost',3306,'flask_blog')
    SQLALCHEMY_TRACK_MODIFICATIONS = False    #设置这一项是每次请求结束后都会自动提交数据库中的变动,      改为手动提交，保持食物一致性

     ###系统相关配置
    HOST = '127.0.0.1'
    PORT = 5000

class ProductConfig(Config):
    DEBUG = False
    ### log相关
    LOG_FILE = 'd:/app.log'

    def __init__(self):
        super(ProductConfig,self).__init__()

     #######################################
    ## 数据库相关 mysql
    ##pymysql
    #######################################
    #see http://docs.sqlalchemy.org/en/latest/dialects/mysql.html#module-sqlalchemy.dialects.mysql.pymysql
    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://{}:{}@{}:{}/{}".format('root','root','localhost',3306,'flask_blog')
    SQLALCHEMY_TRACK_MODIFICATIONS = False    #设置这一项是每次请求结束后都会自动提交数据库中的变动,      改为手动提交，保持食物一致性

     ###系统相关配置
    HOST = '127.0.0.1'
    PORT = 5000

config = {
    "dev":DevConfig,
    'product':ProductConfig
}